import Vue from 'vue'
import VueRouter from 'vue-router'
import PersonalCenter from '../views/qiantai/PersonalCenter.vue'



Vue.use(VueRouter)

//解决vue路由重复导航错误
//获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}


const routes = [

    {
        path: '/qianLogin',
        name: 'QianLogin',
        component: ()=>import('../views/qiantai/denglu/QianLogin'),
        children: []
    },{
        path: '/reset',
        name: 'Reset',
        component: ()=>import('../views/qiantai/denglu/Reset'),
        children: []
    },

    //前台首页等页面
    {
        path: '/',
        name: 'HomePage',
        component: () => import('../views/qiantai/HomePage'),
        children:[
            /*首页*/
            {
                path: '/',
                name: 'QianHome',
                component: ()=>import('../views/qiantai/shouye/QianHome'),
                children: []
            },
            /* 所有商品展示 */
            {
                path: '/goodslist/:name',
                name: 'Goodslist',
                component: ()=>import('../views/qiantai/courseCenter/goodsList'),
                children: []
            },
            //招募中心--商家招募--申请成为商家
            {
                path: '/recruit',
                name: 'Recruit',
                component: ()=>import('../views/qiantai/shouye/teacher/Recruit'),
                children: []
            },
            //招募中心--商家招募--申请店铺
            {
                path: '/recruit1',
                name: 'Recruit1',
                component: ()=>import('../views/qiantai/shouye/teacher/RecruitShop'),
                children: []
            },
            //支付
            {
                path: "/weixin",
                name: "weixin",
                component: ()=>import("../views/qiantai/Wx")
            },
            //支付
            {
                path: "/test01",
                name: "weixin",
                component: ()=>import("../views/qiantai/TestMicrocode")
            },
            //文章详情
            {
                path: '/terrace/:id',
                name: 'terrace-id',
                component: ()=>import('../views/qiantai/shouye/articledetail/articleDetail'),
            },

            /*课程中心*/
            {
                path: '/list',
                name: 'list',
                        component: ()=>import('../views/qiantai/courseCenter/list'),
                children: []
            },
            /* TUI 教育系统管理*/
            {
                path: '/courses',
                name: 'courses',
                component:()=>import('../views/qiantai/courseCenter/courses'),
                children: []
            },
            /*商品详情页面*/
            {
                path: '/DetailId/:id',
                name: 'DetailId',
                component:()=>import('../views/qiantai/details/DetailId'),
                children: []
            },
            /*支付成功后回调的页面！*/
            {
                path: '/paySuccess',
                name: 'PaySuccess',
                component:()=>import('../views/qiantai/details/PaySuccess'),
                children: []
            },
        ]
    },
    /* 申请成为 商家  */
    {
        path: '/apply',
        name: 'Apply',
        component: ()=>import('../views/qiantai/shouye/teacher/Recruit1'),
        children: []
    },
    /*申请店铺*/
    {
        path: '/applyShop',
        name: 'ApplyShop',
        component: ()=>import('../views/qiantai/shouye/teacher/RecruitShop1'),
        children: []
    },
    /* 店铺的基本信息  可以修改*/
    {
        path: '/business/:name',
        name: 'Business',
        component: ()=>import('../views/qiantai/details/Business'),
        children: []
    },
    /* 一家店铺的所有商品的展示*/
    {
        path: '/businessXinX/:shopId',
        name: 'BusinessXinX',
        component: ()=>import('../views/qiantai/details/BusinessXinX'),
        children: []
    },
    //前台展示页面
    {
        path: '/personalCenter',
        name: 'PersonalCenter',
        component: PersonalCenter,
        children:[
            //  个人中心--个人信息--添加收货地址
            {
                path:'/geRenCenter',
                name:'GeRenCenter',
                component: () => import('../views/qiantai/zhongxin/GeRenCenter'),
                children: []
            },
            /* 修改密码 */
            {
                path:'/updatePassword',
                name:'UpdatePassword',
                component: () => import('../views/qiantai/zhongxin/UpdatePassword'),
                children: []
            },
            /* 学习记录 */
            {
                path:'/learningRecord',
                name:'LearningRecord',
                component: () => import('../views/qiantai/zhongxin/LearningRecord'),
                children: []
            },
            /*用户订单详情--所有订单--待会支付订单--已完成订单--未评价订单*/
            {
                path:'/myOrder',
                name:'MyOrder',
                component: () => import('../views/qiantai/zhongxin/MyOrder'),
                children: []
            },
            /* 购物车*/
            {
                path:'/myCart',
                name:'MyCart',
                component: () => import('../views/qiantai/zhongxin/MyCart'),
                children: []
            },
            /* 商品收藏 */
            {
                path:'/myShouCang',
                name:'MyShouCang',
                component: () => import('../views/qiantai/zhongxin/MyShouCang'),
                children: []
            },
            /* 关注的店铺 */
            {
                path:'/myGuanZhu',
                name:'MyGuanZhu',
                component: () => import('../views/qiantai/zhongxin/MyGuanZhu'),
                children: []
            },
            //店铺基本信息----可以对其进行修改
            {
                path:'/business',
                name:'business',
                component: () => import('../views/qiantai/jiangshi/business'),
                children: []
            },
            /* 商家的订单详情--订单编号--订单时间--订单总价--发货地址--发货状态...*/
            {
                path:'/dingdan',
                name:'dingdan',
                component: () => import('../views/qiantai/jiangshi/dingdan'),
                children: []
            },
            /* 修改密码 2 */
            {
                path:'/changePassword',
                name:'changePassword',
                // component: () => import('../views/qiantai/jiangshi/changePassword'),
                component: () => import('../views/qiantai/zhongxin/UpdatePassword'),
                children: []
            },
            /*商家 ----  商品管理*/
            {
                path:'/shangpinguanli',
                name:'shangpinguanli',
                component: () => import('../views/qiantai/jiangshi/shangpinguanli'),
                children: []
            },
            /* 课程--全部课程--审核通过--审核中--审核失败*/
            {
                path:'/recordedManagement',
                name:'RecordedManagement',
                component: () => import('../views/qiantai/jiangshi/RecordedManagement'),
                children: []
            },
            /* 申请添加课程--填写课程信息*/
            {
                path:'/modifyCourse',
                name:'ModifyCourse',
                component: () => import('../views/qiantai/jiangshi/ModifyCourse'),
                children: []
            },
            /* 申请添加课程--上传课程内容*/
            {
                path:'/updateCourse',
                name:'UpdateCourse',
                component: () => import('../views/qiantai/jiangshi/updateCourse'),
                children: []
            },
            /* 视频 */
            {
                path: '/hourGuanLi',
                name: 'hourGuanLi',
                component: ()=>import('../views/qiantai/jiangshi/HourGuanLi'),
                children: []
            },
        ]
    },

]

const router = new VueRouter({
    mode:'history',
    routes
})

export default router
